package cn.edu.sdjzu.xg.bysj.service;

import cn.edu.sdjzu.xg.bysj.dao.GraduateProjectSourceDao;
import cn.edu.sdjzu.xg.bysj.domain.GraduateProjectSource;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class GraduateProjectSourceService {
    private static GraduateProjectSourceDao graduateProjectSourceDao =
            GraduateProjectSourceDao.getInstance();
    private static GraduateProjectSourceService graduateProjectSourceService =
            new GraduateProjectSourceService();

    public static GraduateProjectSourceService getInstance() {
        return graduateProjectSourceService;
    }

    public GraduateProjectSource find(Integer id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        GraduateProjectSource graduateProjectSource = graduateProjectSourceDao.find(id, connection);
        JdbcHelper.close(connection);
        return graduateProjectSource;
    }

    public Collection<GraduateProjectSource> findAll() throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Collection<GraduateProjectSource> graduateProjectSource =
                graduateProjectSourceDao.findAll(connection);
        JdbcHelper.close(connection);
        return graduateProjectSource;
    }
}
